﻿using ENMAX_ArcGIS;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ESRI.ArcGIS.Client.Geometry;
using System.Windows;

namespace ENMAX_ArcGIS_TestProject
{
    
    
    /// <summary>
    ///This is a test class for TroubleTicketTest and is intended
    ///to contain all TroubleTicketTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TroubleTicketTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for MapFrameWidth
        ///</summary>
        [TestMethod()]
        public void MapFrameWidthTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            double expected = 270;
            double actual;
            target.MapFrameWidth = expected;
            actual = target.MapFrameWidth;
            Assert.AreEqual(expected, actual, "Setting MapFrameWidth failed");
        }

        /// <summary>
        ///A test for MapFramePreviouslyOpen
        ///</summary>
        [TestMethod()]
        public void MapFramePreviouslyOpenTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            bool expected = false; // newly created MapFrame should not have been opened previously
            bool actual;
            target.MapFramePreviouslyOpen = expected;
            actual = target.MapFramePreviouslyOpen;
            Assert.AreEqual(expected, actual, "Newly created MapFrame should not have been opened previously");
        }

        /// <summary>
        ///A test for MapFrameOrientation
        ///</summary>
        [TestMethod()]
        public void MapFrameOrientationTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            double expected = 0;
            double actual;
            target.MapFrameOrientation = expected;
            actual = target.MapFrameOrientation;
            Assert.AreEqual(expected, actual, "Setting orientation failed");
        }

        /// <summary>
        ///A test for MapFrameHeight
        ///</summary>
        [TestMethod()]
        public void MapFrameHeightTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            double expected = 270;
            double actual;
            target.MapFrameHeight = expected;
            actual = target.MapFrameHeight;
            Assert.AreEqual(expected, actual, "setting height failed");
        }

        /// <summary>
        ///A test for MapFrameEnvelope
        ///</summary>
        [TestMethod()]
        public void MapFrameEnvelopeTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Envelope expected = new Envelope(-114.15691902877, 51.0591195173411, -114.1102425907428, 51.0835361218838);
            Envelope actual;
            target.MapFrameEnvelope = expected;
            actual = target.MapFrameEnvelope;
            Assert.AreEqual(expected, actual, "Setting Map Envelope Failed");
        }

        /// <summary>
        ///A test for MapFrameCurrentlyOpen
        ///</summary>
        [TestMethod()]
        public void MapFrameCurrentlyOpenTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            bool expected = false;
            bool actual;
            actual = target.MapFrameCurrentlyOpen;
            Assert.AreEqual(expected, actual, "Newly initialized MapFrame should not be opened");
        }

        /// <summary>
        ///A test for MapFrameCenter
        ///</summary>
        [TestMethod()]
        public void MapFrameCenterTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Point expected = new Point(111, 222);
            Point actual;
            target.MapFrameCenter = expected;
            actual = target.MapFrameCenter;
            Assert.AreEqual(expected, actual, "Setting the center point failed");
        }

        /// <summary>
        ///A test for MapCoordinate
        ///</summary>
        [TestMethod()]
        public void MapCoordinateTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            MapPoint actual;
            actual = target.MapCoordinate;
            Assert.AreEqual(actual.X, location.X, "Setting map coordinate failed");
            Assert.AreEqual(actual.Y, location.Y, "Setting map coordinate failed");
        }

        /// <summary>
        ///A test for Description
        ///</summary>
        [TestMethod()]
        public void DescriptionTest()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            string actual;
            actual = target.Description;
            Assert.AreEqual("Sample MapFrame", actual, "Setting description failed");
        }

        /// <summary>
        ///A test for TroubleTicket Constructor
        ///</summary>
        [TestMethod()]
        public void TroubleTicketConstructorTest1()
        {
            MapPoint location = new MapPoint(200, 300);
            string description = "Sample MapFrame";
            TroubleTicket target = new TroubleTicket(location, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Assert.AreEqual("Sample MapFrame", target.Description, "Setting description failed");
            Assert.AreEqual(200, target.MapCoordinate.X, "Setting Map coordinate failed");
            Assert.AreEqual(300, target.MapCoordinate.Y, "Setting Map coordinate failed");
        }

        /// <summary>
        ///A test for TroubleTicket Constructor
        ///</summary>
        [TestMethod()]
        public void TroubleTicketConstructorTest()
        {
            MapPoint mp = new MapPoint(100, 200);
            string description = "Sample MapFrame";

            TroubleTicket target = new TroubleTicket(mp, description, "0006789", TroubleTicket.TroubleTicketSeverity.High);
            Assert.AreEqual("Sample MapFrame", target.Description, "Setting description failed");
            Assert.AreEqual(mp, target.MapCoordinate, "Setting Map coordinates failed");
           
        }
    }
}
